/ Assembly List / LJCGridDataLib / TableData / RowSetValues

Namespace - LJCGridDataLib


Parameters
ljcGridRow - The LJCGridRow object.
dataRow - The DataRow object.
dataDefinition - The DataDefinition object.

Syntax

C#
public static Void RowSetValues(LJCGridRow ljcGridRow, DataRow dataRow, DbColumns dataDefinition)

Updates a grid row with the DataRow values.

Example

C#
// See the DataAccess setup code on the TableGridData class page.

// Updates a grid row with the DbValues.
private void RowSetValuesSql(DataAccess dataAccess)
{
    var sql = "select * from Province";
    var dataTable = dataAccess.GetDataTable(sql);
    if (NetCommon.HasData(dataTable))
    {
        // Create the Grid column definitions.
        var tableGridData = new TableGridData(LJCDataGridName);
        tableGridData.SetGridColumns(dataTable.Columns);

        // Configure the grid columns.
        LJCDataGridName.Columns.Clear();
        LJCDataGridName.LJCAddColumns(tableGridData.GridColumns);

        // Create and load the grid rows individually.
        foreach (DataRow dataRow in dataTable.Rows)
        {
            var ljcGridRow = LJCDataGridName.LJCRowAdd();
            tableGridData.RowSetValues(ljcGridRow, dataRow);
        }
    }
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.